package com.qsd.TeacherSystem.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qsd.TeacherSystem.Service.GradeService;
import com.qsd.TeacherSystem.Service.PaperService;
import com.qsd.common.po.Grade;
import com.qsd.common.po.Paper;
import com.qsd.common.pojo.PaperEntity;
import com.qsd.common.util.Myquery;
import com.qsd.common.util.PageUtil;
import com.qsd.common.util.ResultMsg;
import com.qsd.common.vo.BaseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;


/**
 * 成绩管理
 * create by it_mck·Miao
 *
 */
@Slf4j
@RestController
@RequestMapping("grade")
public class GradeController {

    @Resource
    private GradeService gradeService;
    @Resource
    private PaperService paperService;


    /**
     * 成绩汇总
     * @param answerId
     * @param grade
     * @return
     */
    @PostMapping("subGrade")
    public BaseVo subGrade(Integer answerId, Integer grade) {
        return new BaseVo(gradeService.subGrade(answerId, grade));
    }


    /**
     * 查询考试分数列表,条件搜索
     *
     * @param grade
     * @param page
     * @return
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public ResultMsg fileList(Grade grade,PageUtil page) {
        log.info("考试分数表格重载");
        List<Grade> iPage = gradeService.fileList(grade, page);
        return new ResultMsg(0, "", iPage, page.getCount());
    }

}
